//
//  ViewController.m
//  ScrollView滚动
//
//  Created by caimengjun on 16/12/12.
//  Copyright © 2016年 caimengjun. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIScrollView *scrolView;

@property (nonatomic,weak) UIImageView *imageView;



@end

@implementation ViewController

-(UIImageView *)imageView {
    if (_imageView == nil) {
        UIImage *image = [UIImage imageNamed:@"image"];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        
        [self.scrolView addSubview:imageView];
        
        _imageView = imageView;
    }
    return _imageView;
}

//content内容整个页面
- (void)viewDidLoad {
    [super viewDidLoad];
    // scrolView 的属性
    self.scrolView.contentSize = self.imageView.bounds.size;
    
    //从左上角开始原点放置  point句号
    self.scrolView.contentOffset = CGPointZero;
    
    //偏移多少
    self.scrolView.contentInset = UIEdgeInsetsMake(100, 100, 100, 100); //且无弹簧效果
    //背景颜色
    self.scrolView.backgroundColor = [UIColor redColor];
    
    //是否有弹簧效果
    self.scrolView.bounces = YES;
    
    //指示器 当前位置的指示器
    self.scrolView.showsHorizontalScrollIndicator = NO; //水平
    self.scrolView.showsVerticalScrollIndicator = NO; //垂直
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
